<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Rpc extends CI_Controller {


    public function index( $model ){


        if (!$this->_auth())
            show_error('error',500);

        try {
            $this->load->model($model);
        }catch ( Exception $e ){

            show_error('load model error',500);
        }

        $service = new Yar_Server( new $model );
        $service->handle();
    }

    /**
     * 权限认证
     * @author hteen
     * @return bool
     */
    private function _auth(){

        // TODO:RPC权限验证
        return true;
    }


}
